class SearchController < ApplicationController

	def index

		search_params = {
			query: {
				simple_query_string: {
					query: params[:q],
					default_operator: 'AND',
					minimum_should_match: '70%',
					fields: ['title', 'body']
				}
			},
			highlight: {
				pre_tags: ["[h]"],
				post_tags: ["[/h]"],
				fields: { title: {}, body: {} }
			}
		}
		@result= Elasticsearch::Model.search(search_params,[Topic,User,Reply]).paginate(page: params[:page],per_page: 20)
	end



end
